<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
//    return $request->user();
//});
Route::any('login',function (){})->name('login');

Route::post('wechat/app',[\App\Http\Controllers\Api\User\WechatController::class,'app']);
Route::post('wechat/send-email',[\App\Http\Controllers\Api\User\WechatController::class,'sendEmail']);
Route::post('wechat/email',[\App\Http\Controllers\Api\User\WechatController::class,'email']);

Route::controller(\App\Http\Controllers\Api\User\LoginController::class)->group(function () {
    Route::post('user/login/mobile', 'mobile');
    Route::post('user/login/password', 'password');
    Route::post('user/logout', 'logout');
    Route::post('user/socialite', 'socialite');
});

Route::controller(\App\Http\Controllers\Api\User\RegisterController::class)->group(function () {
    Route::post('user/register/mobile', 'mobile');
});

Route::controller(\App\Http\Controllers\Api\User\WechatController::class)->group(function () {
    Route::post('user/wechat/app', 'app');
    Route::post('user/wechat/mini', 'mini');
    Route::post('user/wechat/mobile', 'mobile');
});

Route::controller(\App\Http\Controllers\Api\Site\DataController::class)->group(function () {
    Route::post('site/data/config', 'config');
    Route::post('site/banner', 'banner');
    Route::post('site/consult-price', 'consultPrice');
});
Route::controller(\App\Http\Controllers\Api\Test\MentalController::class)->group(function () {
    Route::post('test/mental/types', 'types');
    Route::post('test/mental/recommend','recommend');
    Route::post('test/mental/index','index');
    Route::post('test/mental/list','list');
    Route::post('test/mental/topics','topics');
    Route::post('test/mental/start','start');
    Route::post('test/mental/end','end');
});

Route::controller( \App\Http\Controllers\Api\Site\ArticleController::class)->group(function (){
    Route::get('site/article/show/{id}','show');
    Route::get('site/article/index/{id}','index');
});

Route::middleware('auth:sanctum')->group(function () {

    Route::controller(\App\Http\Controllers\Api\Site\UploadController::class)->group(function () {
        Route::post('site/upload/image', 'image');
    });

    Route::controller(\App\Http\Controllers\Api\User\InfoController::class)->group(function () {
        Route::get('user/info/basic', 'basic');
        Route::post('user/info', 'info');
        Route::post('user/info/update', 'update');
        Route::post('user/info/train', 'train');
        Route::post('user/info/mobile', 'mobile');
        Route::post('user/info/client', 'client');
        Route::get('user/info/level', 'level');
    });

    Route::controller(\App\Http\Controllers\Api\User\ExperienceController::class)->group(function () {
        Route::post('user/experience/update', 'update');
        Route::post('user/experience/add', 'add');
        Route::post('user/experience/list', 'list');
        Route::post('user/experience/del', 'del');
    });

    Route::controller(\App\Http\Controllers\Api\User\UserController::class)->group(function () {
        Route::post('user/focus', 'focus');
        Route::post('user/my-fans', 'myFans');
        Route::post('user/my-focus', 'myFocus');
        Route::post('user/feedback', 'feedback');
        Route::post('user/tls-sig', 'tlsSig');
    });

//    Route::post("user/feedback", [\App\Http\Controllers\Api\User\UserController::class, "services"]);
    Route::controller(\App\Http\Controllers\Api\Dynamic\DynamicController::class)->group(function () {
        Route::post('dynamic/update', 'update');
        Route::post('dynamic/del', 'del');
        Route::post('dynamic/add', 'add');
        Route::post('dynamic/list', 'list');
        Route::post('dynamic/my-list', 'myList');
        Route::post('dynamic/their-list', 'theirList');
        Route::post('dynamic/likes', 'likes');
        Route::post('dynamic/likes-list', 'likesList');
    });

    Route::controller(\App\Http\Controllers\Api\Dynamic\TagController::class)->group(function () {
        Route::post('dynamic/tag/add', 'add');
        Route::post('dynamic/tag/del', 'del');
        Route::post('dynamic/tag/list', 'list');
    });

    Route::controller(\App\Http\Controllers\Api\Dynamic\ReportController::class)->group(function () {
        Route::post('dynamic/report/add', 'add');
        Route::post('dynamic/report/reason', 'reason');
    });

    Route::controller(\App\Http\Controllers\Api\Dynamic\ReviewController::class)->group(function () {
        Route::post('dynamic/review/add', 'add');
        Route::post('dynamic/review/list', 'list');
        Route::post('dynamic/review/del', 'del');
    });

    Route::controller(\App\Http\Controllers\Api\User\TeacherController::class)->group(function () {
        Route::post('teacher/skills', 'skills');
        Route::post('teacher/list', 'list');
        Route::post('teacher/open-time', 'openTime');
        Route::post('teacher/comments', 'comments');
    });

    Route::controller(\App\Http\Controllers\Api\Order\OrderController::class)->group(function () {
        Route::post('order/place', 'place');
        Route::post('order/list', 'list');
        Route::post('order/cancel', 'cancel');
        Route::post('order/accept', 'accept');
        Route::post('order/rate', 'rate');
        Route::post('order/confirm', 'confirm');
        Route::post('order/charging', 'charging');
        Route::post('order/appointed', 'appointed');
    });

    Route::controller(\App\Http\Controllers\Api\Order\MsgController::class)->group(function () {
        Route::post('msg/check', 'check');
    });

    Route::controller(\App\Http\Controllers\Api\PaymentController::class)->group(function () {
        Route::post('payment/pay', 'pay');
        Route::post('payment/withdraw', 'withdraw');
    });

    Route::controller(\App\Http\Controllers\Api\User\MyController::class)->group(function () {
        Route::post('my/quizes', 'quizes');
        Route::post('my/orders', 'orders');
    });

    Route::controller(\App\Http\Controllers\Api\User\MoneyController::class)->group(function () {
        Route::post('user/money/list', 'list');
    });

    Route::controller(\App\Http\Controllers\Api\User\TalentController::class)->group(function () {
        Route::post('talent/apply', 'apply');
        Route::post('talent/apply-info', 'applyInfo');
        Route::post('talent/info', 'info');
    });

    Route::controller(\App\Http\Controllers\Api\ActivityController::class)->group(function () {
        Route::post('activity/publish', 'publish');
        Route::post('activity/info', 'info');
        Route::post('activity/apply', 'apply');
        Route::post('activity/list', 'list');
    });

    Route::controller(\App\Http\Controllers\Api\Divination\DivinationController::class)->group(function () {
        Route::post('div/quiz', 'quiz');
        Route::post('div/list', 'list');
        Route::post('div/answer', 'answer');
        Route::post('div/detail', 'detail');
        Route::post('div/del', 'del');
    });

    Route::post('tarot/draw',[\App\Http\Controllers\Api\Divination\TarotController::class,'draw']);
    Route::post('liuyao/draw',[\App\Http\Controllers\Api\Divination\BaziliuyaoController::class,'draw']);
    Route::post('planet/draw',[\App\Http\Controllers\Api\Divination\PlanetController::class,'draw']);
    Route::post('order/recharge-opts',[\App\Http\Controllers\Api\Order\RechargeController::class,'options']);
    Route::post('order/recharge-order',[\App\Http\Controllers\Api\Order\RechargeController::class,'place']);


    Route::controller(\App\Http\Controllers\Api\Collection\CollOrderController::class)->group(function () {
        Route::post('coll/order/place', 'place');
        Route::post('coll/warehouse', 'warehouse');
        Route::post('coll/cast', 'cast');
    });

});
